import { request } from "@/utils/http";
import { reqHospitalstatusParams } from "./model/hospitalSetTypes";
import { DepartmentList, HospitalShowType, ProvinceList, ReqGetHospitalListParams, ReqGetHospitalListResponse, ReqGetHospitalRuleListResponse, ReqGetScheduleListParams, ReqGetScheduleRuleListParams, ScheduleList } from "./model/hostpitalListTypes";


/**
 * 请求 医院列表的 api
 * @param param0   ReqGetHospitalListParams
 * @returns    Promise ReqGetHospitalListResponse
 */
export function reqGetHospitalList({page,limit,...args}:ReqGetHospitalListParams){
    return request.get<any,ReqGetHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`,{
        params:args
    })
}


/**
 * 获取省份信息
 * @returns     promise ProvinceList
 */
export function reqGetProvinceList(){
    return request.get<any,ProvinceList>("/admin/cmn/dict/findByDictCode/province")
}

/**
 * 获取 市 、  区 api
 * @param parentId number
 * @returns   Promise  ProvinceList
 */
export function reqGetCityOrDistrictList(parentId:number){
    return request.get<any,ProvinceList>(`/admin/cmn/dict/findByParentId/${parentId}`)
}

/**
 *  请求医院详情 api
 * @param id string
 * @returns  Promise HospitalShowType
 */
 export function reqGetHospitalShow(id:string){
    return request.get<any,HospitalShowType>(`/admin/hosp/hospital/show/${id}`)
}

/**
 *  更新医院 上下线 状态  api
 * @param param0   {id,status} reqHospitalstatusParams
 * @returns null
 */
 export function reqUpdateHospitalStatus({id,status}:reqHospitalstatusParams){
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`);
}

/**
 * 请求 医院科室  api
 * @param hoscode string  医院编号
 * @returns promise  DepartmentList
 */
export function reqGetDepartmentList(hoscode:string){
    return request.get<any,DepartmentList>(`/admin/hosp/department/${hoscode}`)
}

/**
 * 医院排班  科室 的预约规则 请求api
 * @param param0 {page,limit,hoscode,depcode}:ReqGetScheduleRuleListParams
 * @returns promise ReqGetHospitalRuleListResponse
 */
export function reqGetScheduleRuleList({page,limit,hoscode,depcode}:ReqGetScheduleRuleListParams){
    return request.get<any,ReqGetHospitalRuleListResponse>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

export function reqGetScheduleList({hoscode,depcode,workDate}:ReqGetScheduleListParams){
    return request.get<any,ScheduleList>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}